﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Collections;
using System.IO;
using System.Data.SqlClient;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.User.Identity.IsAuthenticated)
            Response.Redirect("login.aspx");

        if (!Roles.IsUserInRole("超级管理员"))
        {
            string strsql = "SELECT * FROM [member] where [user]='" + Page.User.Identity.Name + "'";
            SqlDataReader sdr = SQLHelper.SQLHelper.ExecReader(strsql);
            if (sdr.Read())
            {
                string user_class = sdr["class"].ToString();
                SqlDataSource1.SelectCommand = string.Format("SELECT * FROM [member] where class='" + user_class + "'");
            }
            else
            {
                SqlDataSource1.SelectCommand = null;
            }

            Label1.Text = String.Format("你所在的班级名称是 {0},　共有 {0} 个班级成员",0,0);


        }


    }    
}